<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>uCXpresso.BLE: /ble/ble_heartrate/src/main.cpp</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../upnp.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">uCXpresso.BLE
   &#160;<span id="projectnumber">v1.0.4</span>
   </div>
   <div id="projectbrief">RTOS C++ Framework for Bluetooth Low Energy</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../modules.html"><span>Modules</span></a></li>
      <li><a href="../../annotated.html"><span>Classes</span></a></li>
      <li><a href="../../examples.html"><span>Examples</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d4/d70/_2ble_2ble_heartrate_2src_2main_8cpp-example.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Groups</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">/ble/ble_heartrate/src/main.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<p>This is an example of how to use the <a class="el" href="../../d3/d81/classble_heart_rate.html">bleHeartRate</a> class. More details about this example.</p>
<div class="fragment"><div class="line"><span class="comment">/*</span></div>
<div class="line"><span class="comment"> ===============================================================================</span></div>
<div class="line"><span class="comment"> Name        : main.cpp</span></div>
<div class="line"><span class="comment"> Author      : Jason</span></div>
<div class="line"><span class="comment"> Version     : v1.0.2</span></div>
<div class="line"><span class="comment"> Date        : 2014/2/23</span></div>
<div class="line"><span class="comment"> Description :  Heart rate measurement service for BLE</span></div>
<div class="line"><span class="comment"> ===============================================================================</span></div>
<div class="line"><span class="comment">                                 History</span></div>
<div class="line"><span class="comment"> ---------+---------+--------------------------------------------+-------------</span></div>
<div class="line"><span class="comment"> DATE     | VERSION |   DESCRIPTIONS                             |  By</span></div>
<div class="line"><span class="comment"> ---------+---------+--------------------------------------------+-------------</span></div>
<div class="line"><span class="comment"> 2014/2/18  v1.0.0  First Edition                                   Jason</span></div>
<div class="line"><span class="comment"> 2014/2/21  v1.0.1  Add LED Faded task                              Jason</span></div>
<div class="line"><span class="comment"> 2014/2/23  v1.0.2  Add Health Thermometer Service                  Jason</span></div>
<div class="line"><span class="comment"> ===============================================================================</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#include &quot;uCXpresso.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/serial.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/usb_cdc.h&quot;</span></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#include &quot;debug.h&quot;</span></div>
<div class="line"><span class="preprocessor">#define DBG     dbg_printf</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#else</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define DBG(...)</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// TODO: insert other include files here</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/bus.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/ble_serial.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/ble_heartrate.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/ble_battery.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;class/ble_ht.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;sensor/heart_beat/pulse_sensor.h&quot;</span> <span class="comment">// use extensions library</span></div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// TODO: insert other definitions and declarations here</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// myPulseSensor Class</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="keyword">class </span>myPulseSensor: <span class="keyword">public</span> CPulseSensor {</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line">    <span class="keywordtype">int</span> fadeRate;</div>
<div class="line"></div>
<div class="line">    myPulseSensor(<a class="code" href="../../db/dff/group___enumerations.html#gaa2194064f056aee671a1ed1555c2aaf9">ADC_CH_T</a> pulsePin) :</div>
<div class="line">        CPulseSensor(pulsePin) {    <span class="comment">// Construct for CPulseSensor</span></div>
<div class="line">        fadeRate = 0;               <span class="comment">// used to fade LED on with PWM on fadePin</span></div>
<div class="line">    }</div>
<div class="line"></div>
<div class="line"><span class="keyword">protected</span>:</div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="comment">// Override the onBlink for your led event</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="keyword">virtual</span> <span class="keywordtype">void</span> onBlink(<a class="code" href="../../db/dff/group___enumerations.html#ga6f24594071a026b31238ab8cb80d6a80">PIN_LEVEL_T</a> val) {</div>
<div class="line">        <span class="keywordflow">if</span> ( val==<a name="a0"></a><a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80a0c3a1dacf94061154b3ee354359c5893">HIGH</a> ) {</div>
<div class="line">            fadeRate = 256;</div>
<div class="line">        }</div>
<div class="line">    }</div>
<div class="line">};</div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// Fade LED Task</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="keyword">class </span>ledTask: <span class="keyword">public</span> <a name="_a1"></a><a class="code" href="../../d0/d26/class_c_thread.html">CThread</a> {</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line">    ledTask(myPulseSensor &amp;pulse) {</div>
<div class="line">        m_pulse = &amp;pulse;</div>
<div class="line">    }</div>
<div class="line"><span class="keyword">protected</span>:</div>
<div class="line">    myPulseSensor *m_pulse;</div>
<div class="line"></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="comment">// Override CThread::run() to show the Faded LEDs</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a name="a2"></a><a class="code" href="../../d0/d26/class_c_thread.html#a071c3d3b3c19a7bd6a01aca073a9b4d7">run</a>() {</div>
<div class="line">        <a name="_a3"></a><a class="code" href="../../de/d89/class_c_bus.html">CBus</a> leds(<a name="a4"></a><a class="code" href="../../db/dff/group___enumerations.html#gga65a2241721e4acb573e0c3fe29ac432fadac6477842247cab1a8c02c65f431b44">LED1</a>, <a name="a5"></a><a class="code" href="../../db/dff/group___enumerations.html#gga65a2241721e4acb573e0c3fe29ac432fa8379bbaa96d151e6adac488b2a147b7a">LED2</a>, <a name="a6"></a><a class="code" href="../../db/dff/group___enumerations.html#gga65a2241721e4acb573e0c3fe29ac432fa5dec293e081e0fc78369c842fab8452b">LED3</a>, <a name="a7"></a><a class="code" href="../../db/dff/group___enumerations.html#gga65a2241721e4acb573e0c3fe29ac432fad60e39b8d1701d30aa64f80343217342">LED4</a>, <a name="a8"></a><a class="code" href="../../db/dff/group___enumerations.html#gga65a2241721e4acb573e0c3fe29ac432fadc6f24fd6915a3f2786a1b7045406924">END</a>);</div>
<div class="line">        <span class="keywordflow">while</span>( <a name="a9"></a><a class="code" href="../../d0/d26/class_c_thread.html#a4a0f0727be4714cef1e24150a869d403">isAlive</a>() ) {    <span class="comment">// use the isAlive() mean the task can be kill()</span></div>
<div class="line">            <span class="comment">//</span></div>
<div class="line">            <span class="comment">// Indicate led in every 20ms</span></div>
<div class="line">            <span class="comment">//</span></div>
<div class="line">            <span class="keywordflow">if</span> ( m_pulse-&gt;fadeRate&gt;0 ) {</div>
<div class="line">                leds[0] = <a name="a10"></a><a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80add01b80eb93658fb4cf7eb9aceb89a1d">LED_ON</a>;</div>
<div class="line">                <span class="keywordflow">if</span> ( m_pulse-&gt;fadeRate&gt;64 ) {</div>
<div class="line">                    leds[1] = <a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80add01b80eb93658fb4cf7eb9aceb89a1d">LED_ON</a>;</div>
<div class="line">                    <span class="keywordflow">if</span> ( m_pulse-&gt;fadeRate&gt;128 ) {</div>
<div class="line">                        leds[2] = <a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80add01b80eb93658fb4cf7eb9aceb89a1d">LED_ON</a>;</div>
<div class="line">                        <span class="keywordflow">if</span> ( m_pulse-&gt;fadeRate&gt;196 ) {</div>
<div class="line">                            leds[3] = <a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80add01b80eb93658fb4cf7eb9aceb89a1d">LED_ON</a>;</div>
<div class="line">                        } <span class="keywordflow">else</span> {</div>
<div class="line">                            leds[3] = <a name="a11"></a><a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80afc0ca8cc6cbe215fd3f1ae6d40255b40">LED_OFF</a>;</div>
<div class="line">                        }</div>
<div class="line">                    } <span class="keywordflow">else</span> {</div>
<div class="line">                        leds[2] = <a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80afc0ca8cc6cbe215fd3f1ae6d40255b40">LED_OFF</a>;</div>
<div class="line">                    }</div>
<div class="line">                } <span class="keywordflow">else</span> {</div>
<div class="line">                    leds[1] = <a class="code" href="../../db/dff/group___enumerations.html#gga6f24594071a026b31238ab8cb80d6a80afc0ca8cc6cbe215fd3f1ae6d40255b40">LED_OFF</a>;</div>
<div class="line">                }</div>
<div class="line">                m_pulse-&gt;fadeRate -= 16;</div>
<div class="line">            } <span class="keywordflow">else</span> leds = 0;    <span class="comment">// turn off all leds</span></div>
<div class="line">            sleep(20);</div>
<div class="line">        }</div>
<div class="line">    }</div>
<div class="line">};</div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// main task</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">void</span>) {</div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">    #if __USE_USB</span></div>
<div class="line"><span class="preprocessor"></span>        <a name="_a12"></a><a class="code" href="../../d6/dc5/classusb_c_d_c.html">usbCDC</a> ser;</div>
<div class="line">        ser.<a name="a13"></a><a class="code" href="../../d6/dc5/classusb_c_d_c.html#a49d431de50da7ccacf91ef33b04e99d2">connect</a>();</div>
<div class="line"><span class="preprocessor">    #else</span></div>
<div class="line"><span class="preprocessor"></span>        <a name="_a14"></a><a class="code" href="../../d8/d1d/class_c_serial.html">CSerial</a> ser;</div>
<div class="line">        ser.<a name="a15"></a><a class="code" href="../../d8/d1d/class_c_serial.html#a0c80ea521e310305579e787f21a55233">settings</a>(115200);</div>
<div class="line"><span class="preprocessor">    #endif</span></div>
<div class="line"><span class="preprocessor"></span>    <a name="_a16"></a><a class="code" href="../../d4/d37/class_c_debug.html">CDebug</a> dbg(ser);</div>
<div class="line">    dbg.start();</div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span></div>
<div class="line">    <span class="comment">/*************************************************************************</span></div>
<div class="line"><span class="comment">     *</span></div>
<div class="line"><span class="comment">     *                         your setup code here</span></div>
<div class="line"><span class="comment">     *</span></div>
<div class="line"><span class="comment">    **************************************************************************/</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="comment">// BLE engine (serial stream)</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <a name="_a17"></a><a class="code" href="../../d7/d03/classble_serial.html">bleSerial</a>   ble(<span class="stringliteral">&quot;myHRM&quot;</span>);</div>
<div class="line">    ble.enable(96);</div>
<div class="line"></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="comment">// Heart Beat Rate Service</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <a name="_a18"></a><a class="code" href="../../d3/d81/classble_heart_rate.html">bleHeartRate</a> hrm(ble);</div>
<div class="line">    hrm.supportContact(<span class="keyword">true</span>);</div>
<div class="line">    hrm.contactStatus(<span class="keyword">true</span>);</div>
<div class="line">    hrm.setSensorLocation(<a name="a19"></a><a class="code" href="../../db/dff/group___enumerations.html#gga142ef314a313f7071c544be2939c13a3a677a2bce35979f3240d4c031b4504b3e">HRSL_FINGER</a>);</div>
<div class="line"></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="comment">// Battery Level &amp; Health Thermometer Service (Use internal sensors)</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <a name="_a20"></a><a class="code" href="../../d8/d3b/classble_battery_level.html">bleBatteryLevel</a>      bat(ble);</div>
<div class="line">    <a name="_a21"></a><a class="code" href="../../d9/d26/classble_health_thermometer.html">bleHealthThermometer</a> ht(ble);</div>
<div class="line"></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="comment">// Pulse Sensor</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    myPulseSensor pulse(<a name="a22"></a><a class="code" href="../../db/dff/group___enumerations.html#ggaa2194064f056aee671a1ed1555c2aaf9a9a6afaa33efd88ccbd62117ab0555cce">AD0</a>);   <span class="comment">// signal on AD0</span></div>
<div class="line">    pulse.start();</div>
<div class="line"></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="comment">// Fade LED task</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    ledTask led(pulse);</div>
<div class="line">    led.start(<span class="stringliteral">&quot;LED&quot;</span>, 50);   <span class="comment">// reduce stack size to 58 to increase the heap memory</span></div>
<div class="line"></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <span class="comment">//</span></div>
<div class="line">    <a name="_a23"></a><a class="code" href="../../d5/d5b/class_c_timeout.html">CTimeout</a> t1, t2, t3;</div>
<div class="line">    <span class="keywordtype">float</span> value;</div>
<div class="line">    uint8_t level;</div>
<div class="line"></div>
<div class="line">    <span class="keywordflow">while</span>(1) {</div>
<div class="line">        <span class="comment">/**********************************************************************</span></div>
<div class="line"><span class="comment">         *</span></div>
<div class="line"><span class="comment">         *                         your loop code here</span></div>
<div class="line"><span class="comment">         *</span></div>
<div class="line"><span class="comment">         **********************************************************************/</span></div>
<div class="line">        <span class="comment">//</span></div>
<div class="line">        <span class="comment">// Heart Rate Measurement</span></div>
<div class="line">        <span class="comment">//</span></div>
<div class="line">        <span class="keywordflow">if</span> ( hrm.isAvailable() ) {</div>
<div class="line">            <span class="keywordflow">if</span> ( t1.<a name="a24"></a><a class="code" href="../../d5/d5b/class_c_timeout.html#a3841c7c53689d2ef8559a6c5e402aa5b">isExpired</a>(1000) ) { <span class="comment">// interval 1 second</span></div>
<div class="line">                t1.<a name="a25"></a><a class="code" href="../../d5/d5b/class_c_timeout.html#a663a09bb51c1de8f8d83bd62fdc1a688">reset</a>();</div>
<div class="line">                hrm.sendMeasure((uint8_t)pulse.BPM);</div>
<div class="line">            }</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="comment">//</span></div>
<div class="line">        <span class="comment">// Battery Level</span></div>
<div class="line">        <span class="comment">//</span></div>
<div class="line">        <span class="keywordflow">if</span> ( t2.<a class="code" href="../../d5/d5b/class_c_timeout.html#a3841c7c53689d2ef8559a6c5e402aa5b">isExpired</a>(10000) ) {    <span class="comment">// interval 10 seconds</span></div>
<div class="line">            t2.<a class="code" href="../../d5/d5b/class_c_timeout.html#a663a09bb51c1de8f8d83bd62fdc1a688">reset</a>();</div>
<div class="line">            <span class="keywordflow">if</span> ( bat.readSystemVoltage(value) ) {</div>
<div class="line">                level = map(value, 2.0, 3.3, 0, 100);   <span class="comment">// 0%~100%</span></div>
<div class="line">                bat.sendBatteryLevel(level);</div>
<div class="line">            }</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="comment">//</span></div>
<div class="line">        <span class="comment">// Health Thermometer Service</span></div>
<div class="line">        <span class="comment">//</span></div>
<div class="line">        <span class="keywordflow">if</span> ( t3.<a class="code" href="../../d5/d5b/class_c_timeout.html#a3841c7c53689d2ef8559a6c5e402aa5b">isExpired</a>(5000) ) { <span class="comment">// interval 5 seconds</span></div>
<div class="line">            t3.<a class="code" href="../../d5/d5b/class_c_timeout.html#a663a09bb51c1de8f8d83bd62fdc1a688">reset</a>();</div>
<div class="line">            <span class="keywordflow">if</span> ( ht.readTemperature(value) ) {</div>
<div class="line">                ht.sendMeasure(value);</div>
<div class="line">            }</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">    }</div>
<div class="line">    <span class="keywordflow">return</span> 0 ;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// default memory pool</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="keyword">static</span> uint8_t mem_pool[DEFAULT_POOL_SIZE];</div>
<div class="line"></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="comment">// setup before the system startup</span></div>
<div class="line"><span class="comment">//</span></div>
<div class="line"><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> <span class="keywordtype">void</span> sys_setup(<span class="keywordtype">void</span>) {</div>
<div class="line">    pool_memadd((uint32_t)mem_pool, <span class="keyword">sizeof</span>(mem_pool));</div>
<div class="line"><span class="preprocessor">#if __USE_USB==0</span></div>
<div class="line"><span class="preprocessor"></span>    pool_memadd(USB_MEM_BASE, USB_MEM_SIZE);</div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span>}</div>
<div class="line"></div>
</div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Fri Apr 11 2014 23:43:25 for uCXpresso.BLE by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
